#ifndef DOCUMENT_GUI_H_H_H_
#define DOCUMENT_GUI_H_H_H_

#include "Persistence.h"
#include "Document_App.h"
class ViewWindow;
class Document_App;
class BaseView;
namespace Gui
{
   class ViewProviderDocumentObject;
   class ViewProvider;
}


class Application;
class Document_Gui : public Base::Persistence
{
public:
	Document_Gui(Document_App* pdoc,Application* app);
	~Document_Gui(void);

	mutable boost::signal<void (const Gui::ViewProviderDocumentObject&)> signalNewObject;

	void slotNewObject(const App::DocumentObject&);

	unsigned int getMemSize (void) const;

	bool save();

	bool saveAs(void);

	/// This method is used to save properties or very small amounts of data to an XML document.
	virtual void Save (Base::Writer &writer) const;
	/// This method is used to restore properties from an XML document.
	virtual void Restore(Base::XMLReader &reader);
	/// This method is used to save large amounts of data to a binary file.
	virtual void SaveDocFile (Base::Writer &writer) const;
	/// This method is used to restore large amounts of data from a binary file.
	virtual void RestoreDocFile(Base::Reader &reader);

public:

	void createView(const char* sType);

	void attachView(BaseView* pcView,bool bpassiv = false);
	void detachView(BaseView* pcView,bool bpassiv = false);

    ViewWindow* getActiveView(void)const;

	Document_App* getDocument()const;

	Gui::ViewProvider* getViewProvider(const App::DocumentObject* pobject)const;

    bool canClose();	
	bool isLastView();

	struct DocumentP* d;
	
};
#endif


